package com.example.spi;

import java.util.ServiceLoader;

/**
 * Project:spring-spi
 * <p>
 * Title:Example.java
 * <p>
 * Description:SPI(Service Provider Interface)机制测试,主要用于解耦，功能实现可插拔.
 * <p>
 * Copyrigth:Jiang Software LTD.co Copyright (c) 2021
 * <p>
 * 
 * @version 1.0
 * @since 1.8
 * @author jiang
 * @history 2021 jiang create
 */
public class Example {

	public static void main(String[] args) {
		ServiceLoader<PayService> services = ServiceLoader.load(PayService.class);
		for (PayService service : services) {
			System.out.println(service.getClass());
			service.pay();
		}

	}

}
